package com.stanford.ml.svm;

/**
 * Problem is an optimization problem formulated through the margin
 * equation that separates the pivot positioned instances.
 * @author Fatih Sunor
 *
 */
public class Problem {
	
	private int _l;
	private int _n;
	private int[] _y;
	private Feature[][] _x;
	
	/**
	 * @return the number of training data
	 */
	public int getL() {
		return _l;
	}
	
	/**
	 * @param set the number of training data
	 */
	public void setL(int l) {
		_l = l;
	}
	
	/**
	 * @return the number of sets
	 */
	public int getN() {
		return _n;
	}
	
	/**
	 * @param number of sets
	 */
	public void setN(int n) {
		this._n = n;
	}
	
	/**
	 * @return the y
	 */
	public int[] getY() {
		return _y;
	}
	
	/**
	 * @param y the y to set
	 */
	public void setY(int[] y) {
		_y = y;
	}
	
	/**
	 * @return the x
	 */
	public Feature[][] getX() {
		return _x;
	}
	
	/**
	 * @param x the x to set
	 */
	public void setX(Feature[][] x) {
		this._x = x;
	}
	
	public Problem() {
		_l = 0;
		_n = 0;
	}
	
	/**
	 * Populates a problem based on features and class labels
	 * @param features
	 * @param classLabels
	 */
	public void populateProblem(Feature[][] features, Integer[] classLabels){
		_x = features;
		_y = new int[classLabels.length];
		for(int i=0; i<classLabels.length; i++){
			_y[i] = classLabels[i];
		}
	}
}
